local skill = fk.CreateSkill{
    name = "lingling__roushendajiao"
}
Fk:loadTranslationTable{
    ["lingling__roushendajiao"] = "肉神大叫",
    [":lingling__roushendajiao"] = "当你使用一张牌后，若你本回合使用牌点数递增，你可以摸一张牌。",
    ["@lingling__roushendajiao-turn"] = "肉神大叫",
}
skill:addEffect(fk.CardUsing,{
    anim_type = "drawcard",
    can_trigger = function (self, event, target, player, data)
        if player == target and player:hasSkill(skill.name) then
            return data.extra_data and data.extra_data.lingling__roushendajiao
        end
    end,
    on_use = function (self, event, target, player, data)
        player:drawCards(1,skill.name)
    end,

    can_refresh = function (self, event, target, player, data)
        return player == target and player:hasSkill(skill.name)
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        data.extra_data = data.extra_data or {}
        local mark = player:getMark("@lingling__roushendajiao-turn")
        if type(mark) == "number" then
            if mark ~= 0 and data.card.number ~= mark and data.card.number ~= 0 then
                if data.card.number > mark then
                    data.extra_data.lingling__roushendajiao = true
                    room:setPlayerMark(player, "@lingling__roushendajiao-turn", data.card.number)
                else
                    room:setPlayerMark(player, "@lingling__roushendajiao-turn", "×")
                end
            else
                room:setPlayerMark(player, "@lingling__roushendajiao-turn", data.card.number)
            end
        end
    end,
})
skill:addAcquireEffect(function(self, player)
    local room = player.room
    local skill_event = room.logic:getCurrentEvent()
    local num = 0
    room.logic:getEventsByRule(GameEvent.UseCard, 1, function (e)
        if e.id < skill_event.id then
            local use = e.data
            if use.from == player then
                num = math.max(num, use.card.number)
            end
        end
    end, 0, Player.HistoryTurn)
    room:setPlayerMark(player,"@lingling__roushendajiao-turn",num)
end)
return skill